package com.ht.medicaltreatment.viewmodel

import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.ToastUtils
import com.ht.medicaltreatment.bean.PDOrderDetailBean
import com.ht.medicaltreatment.bean.SghyMarshall
import com.xgst.lib.http.ApiResult
import kotlinx.coroutines.launch

class InventoryOrderDetailViewModel : BaseViewModel() {
    fun reuqestSampleBox(id:String,onSuccess:(PDOrderDetailBean)->Unit){
        showProgress()
        viewModelScope.launch {
            val bean = mApi.getSampleBoxs(id)
            when(bean){
                is ApiResult.Success -> {
                    dismissProgress()
                    onSuccess(bean.data.data!!)
                }
                is ApiResult.Error -> {
                    dismissProgress()
                    ToastUtils.showShort(bean.errorMessage)
                }
            }
        }
    }
}
